
#import "AFNetworking.h"
NS_ASSUME_NONNULL_BEGIN

typedef enum {
    Get = 0,
    Post,
    Put,
    Delete,
} NetworkMethodType;


typedef enum {
    ShowLoading = 1,   //显示加载菊花框
    ShowErrorAlert,    //显示错误弹窗
    ShowSuccessAlert,  //显示操作成功弹窗
    ShowAutoHide,      //显示弹窗后自动消失
    ShowErrorView,     //显示网络请求错误时候的占位图  (需要实现BSNetProtocol里的协议 传入展示的视图)
    RequestJSON ,      //json请求 默认form
    ShowNotLogin ,     //登录失效的时候 不要跳转登录界面
    UploadMustAll ,    //上传图片一张失败后面不上传
    ReturnErrCode ,    //返回错误码
} NetworkInfoType;

@interface BSNetAPIClient : AFHTTPSessionManager
/// 初始化
+ (instancetype)sharedClient;
/// baseURL
+ (NSString *)baseURLStr;
/// 当前环境
+ (NSString *)currentEnvironment;
/// 对应key的url
+ (NSString *)realURLWithKey:(NSString *)key;
/// 切换环境
+ (void)changeEnvironmentTo:(NSString *)environment;

/// 网络请求
/// @param aPath 请求路径
/// @param params 请求参数
/// @param vc 控制器
/// @param type 请求方式
/// @param infoArr  带NetworkInfoType枚举的数组
/// @param block 成功和失败的回调
- (void)requestWithPath:(nullable NSString *)aPath
                 params:(nullable NSDictionary *)params
         viewController:(nullable UIViewController*)vc
                   type:(NetworkMethodType)type
                   info:(nullable NSArray<NSNumber*>*)infoArr
                  block:(nullable PostNetWorkBock)block;

/// 图片上传 多张图片
/// @param aPath 请求路径
/// @param params 请求参数
/// @param vc 控制器
/// @param images 图片数组
/// @param names 图片名字数组
/// @param infoArr  带NetworkInfoType枚举的数组
/// @param block 成功和失败的回调
- (void)requestImageWithPath:(nullable NSString *)aPath
                      params:(nullable NSDictionary *)params
              viewController:(nullable UIViewController*)vc
                      images:(NSArray <UIImage*>*)images
                       names:(nullable NSArray <NSString*>*)names
                        info:(nullable NSArray<NSNumber*>*)infoArr
                       block:(nullable PostNetWorkBock)block;

/// 图片上传 单张
/// @param aPath 请求路径
/// @param params 请求参数
/// @param vc 控制器
/// @param image 图片
/// @param name 图片名字
/// @param infoArr  带NetworkInfoType枚举的数组
/// @param block 成功和失败的回调
- (void)requestOneImageWithPath:(nullable NSString *)aPath
                         params:(nullable NSDictionary *)params
                 viewController:(nullable UIViewController*)vc
                          image:(UIImage*)image
                           name:(nullable NSString*)name
                           info:(nullable NSArray<NSNumber*>*)infoArr
                          block:(nullable PostNetWorkBock)block;
@end

NS_ASSUME_NONNULL_END
